package cn.wolfcode.luowowo.acticle.query;

import cn.wolfcode.luowowo.acticle.domain.Travel;
import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

/**
 * 游记查询类
 */
@Getter
@Setter
public class TravelQueryObject extends QueryObject {
    private Integer state = -1;  //状态
    private Integer destId = -1; //目的地id

    //查询条件和排序字段
    private int travelTimeType = -1; //旅游时间
    private int dayType = -1;        //旅游天数
    private int perExpendType = -1;  //人均消费
    private int orderType = 1;       //排序

    //封装后的查询数据和排序数据
    private TravelCondition travelTime;
    private TravelCondition days;
    private TravelCondition perExpend;
    private String order;

    //get方法
    public TravelCondition getTravelTime(){ return TravelCondition.TRAVEL_TIME.get(travelTimeType);}
    public TravelCondition getDays(){ return TravelCondition.TRAVEL_DAYS.get(dayType);}
    public TravelCondition getPerExpend(){ return TravelCondition.TRAVEL_PEREXPEND.get(perExpendType);}
    public String getOrder(){
        if(orderType == 1){
            return "t.releaseTime desc";
        }
        return "t.viewnum desc";
    }
}
